<?php


error_reporting(0);
//header('Content-Type:text/html;charset=utf-8');
header('Content-Type:text/xml;charset=utf-8');
//$ids = $_GET['url'];
$ids = $_POST['u'];

        //http://cd.duoduotv.com/index.php?m=vod-search&wd=%E9%AC%BC%E5%90%B9%E7%81%AF
        $b = $ids;
        $b = rawurlencode(mb_convert_encoding($b, 'utf-8', 'utf-8')); 
        $b = 'http://so.le.com/s?wd='.$b;

        $content = file_get_contents($b);

        //preg_match('/<div class=\"So-search-main\">(.*?)<!--视频列表-->/is',$content,$c);
        preg_match('/<dl class=\"play-terminal active j-tui-terminal\"><\/dl>(.*?)<!--视频列表-->/is',$content,$c);
        
        preg_match_all('/class=\"img-w180 j-baidu-a\"(.*?)src=\"(.*?)\"/is',$c[1],$c3);  //海报
        //preg_match_all('/<div class=\"info-tit\">(.*?)<div class=\"info_list\">/is',$c[1],$c2);  //标题+网址链接
        preg_match_all('/<div class=\"info-tit\">(.*?)<a target=\"_blank\" class=\"j-baidu-a\" title=\"(.*?)\" href=\"(.*?)\"(.*?)<a target=\"_blank\" href=\"(.*?)\">(.*?)<\/a>(.*?)<div class=\"info_list\">/is',$c[1],$c2);  //标题+网址链接
        



echo "<?xml version='1.0' encoding='utf-8'?>";
echo "<SubFucParams>";
echo "<Version>全网视频搜索结果：</Version>";



        $num = count($c2[2]); 
        for($i=0;$i<$num;++$i){ 
            $k2 = $c2[2][$i]; //标题
            $k3 = $c2[3][$i]; //网址
            $k4 = $c2[6][$i]; //类型
            $k5 = $c3[2][$i]; //海报
           // $v2 = $v.$k.'<br>';




            $v = '[视频标题开始]'.$k2.'['.$k4.']'.'[视频标题结束]'.'[视频网址开始]'.$k3.'[视频网址结束]'.'[视频图片开始]'.$k5.'[视频图片结束]';

            echo "<Title>$v</Title>";

			
        }


            		
echo "</SubFucParams>";
			
		






       
        /*

        $num = count($c2[1]); 
        for($i=0;$i<$num;++$i){ 
            $k = $c2[1][$i];
            $v = $v.$k.'<br>';
        }
        

        preg_match_all('/<a target=\"_blank\" class=\"j-baidu-a\" title=\"(.*?)\" href=\"(.*?)\"/is',$v,$d); //标题
        preg_match_all('/<a target=\"_blank\" href=\"(.*?)\">(.*?)<\/a>/is',$v,$d2); //网址

        $num = count($d[1]); 
        for($i=0;$i<$num;++$i){ 
            $k2 = $d[1][$i];
            $k3 = $d[2][$i];
            $k4 = $d2[2][$i];
           // $v2 = $v.$k.'<br>';

            echo '[视频标题开始]'.$k2.'['.$k4.']'.'[视频标题结束]'.'[视频网址开始]'.$k3.'[视频网址结束]'.'<br>';
        }
        
		*/




















?>
